<template>
	<view :class="['vh100',{'dark':theme == 'dark'}]">
		<view class="plr10 ptb10">
			<navigator 
			:url="'/pages/home/newsDetail?id='+item.carouselId" v-for="(item,i) in list" :key="i" class=" plr8 bdb_blue3 ptb20">
				<view class="ft14 color1 ellipsis">{{item.title}}</view>
				<!-- <view class="ft12 blue4 tr">2012-02-30</view> -->
			</navigator>
			<view v-if="show" class="tc mtb20 blue4 ft12">{{more}}</view>
			<!-- <uni-load-more :loadingType="status"></uni-load-more> -->
		</view>
	</view>
	
</template>

<script>
	import {mapState,mapActions,mapGetters} from 'vuex';
	import uniLoadMore from "../../components/uni-load-more.vue"
	import {commonNewsList} from '../../common/apiString.js'
	import {myMixins} from '@/common/myMixins.js'
	export default{
		mixins:[myMixins],
		data(){
			return{
				list:[],
				page:1,
				more:this.$t('home').up,
				show:true
			}
		},
		components: {
			uniLoadMore
		},
		computed:{
			...mapState({
			  theme:state=>state.theme
			}),
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title:this.$t('home').news
			})
			this.$utils.setTheme(this.theme);
			this.getList()
		},
		onShow(){
			
		},
		methods: {
			getList() {
				var that = this;
				that.list=[]
				// uni.showLoading();
				this.$utils.initData({url:commonNewsList,data:{current:this.page,language:uni.getStorageSync('lang')},type:'post'},(res,msg)=>{
					uni.hideLoading();
					if(that.page == 1){
						if(res.records.length<=res.total){
							that.show = false;
						}
					}
					that.list = that.list.concat(res.records);
					if(res.list.length>0){
						that.more = that.$t('home').up;
						that.show = true;
					}else{
						that.more = that.$t('home').nomore
					}
				})
			}
		},
		onReachBottom() {
			this.status = 'loading'
			this.page ++;
			this.getList();
		}
	}
</script>

<style scoped>
	
	.ft14 {
	    font-size: 4vw;
	}
	
</style>
